<template>
  <a-drawer :visible="_d.visible" width="500" title="新增自定义清单" :maskClosable="false" @close="close()">
    <a-form :label-col="{style: {width: '6em'}}">
			<a-form-item label="清单名称" v-bind="validateInfos.aaa">
    		<a-input v-model:value="_d.form.aaa" placeholder="请输入"></a-input>
    	</a-form-item>
    	<a-form-item label="使用对象" v-bind="validateInfos.bbb">
    		<a-input v-model:value="_d.form.bbb" placeholder="请输入"></a-input>
    	</a-form-item>
    </a-form>
    <template #extra>
      <a-space>
        <a-button @click="close()">取消</a-button>
        <a-button type="primary" @click="submit()">提交</a-button>
      </a-space>
    </template>
  </a-drawer>
</template>

<script setup>
	import { reactive, computed } from 'vue'
	import { Form, notification } from 'ant-design-vue';

	const emit = defineEmits(['reload']);

	const _d = reactive({
		visible: false,
		type: 1, // 1添加，2编辑
		record: null,

		form: {
			aaa: '',
			bbb: '',
			ccc: '',
			ddd: '',
		},

		rules: {
			aaa: [
				{ required: true, trigger: 'blur', message: '请选择风险类别' }
			],
			bbb: [
				{ required: true, trigger: 'blur', message: '请选择管控形式' }
			],
		},
	})

	// 验证
	const { resetFields, validate, validateInfos } = Form.useForm(_d.form, _d.rules);

	function open (type, record) {
		resetFields();
		
		_d.visible = true;
		
	}

	// 获取详情
	function getData() {
		
	}

	// 提交
	function submit() {
		validate().then(() => {
			
		})
	}

	function close () {
		_d.visible = false;
	}

	defineExpose({
		open
	})

</script>
<style scoped>

</style>